package com.shfl.servermanage.pagehelper;

import com.github.pagehelper.PageHelper;

/**
 * @Auther: Mr.Lee
 * @Date: 2019/2/15 14:21
 * @Description: 分页插件
 */
public class PageHelperUtils {

    public static void startPageWithCount(Pageable pageable) {
        if (pageable != null && pageable.isPageable()) {
            PageHelper.startPage(pageable.getPageNo(), pageable.getPageSize(), true);
            if (pageable.getOrderBy() != null && !"".equals(pageable.getOrderBy().trim())) {
                PageHelper.orderBy(pageable.getOrderBy());
            }
        }
    }

    public static void startPageWithoutCount(Pageable pageable) {
        if (pageable != null && pageable.isPageable()) {
            PageHelper.startPage(pageable.getPageNo(), pageable.getPageSize(), false);
            if (pageable.getOrderBy() != null && !"".equals(pageable.getOrderBy().trim())) {
                PageHelper.orderBy(pageable.getOrderBy());
            }
        }
    }
}
